
package com.xwyzsn.rentcar.controller;
import com.xwyzsn.rentcar.entity.Address;
import com.xwyzsn.rentcar.service.AddressService;
import com.xwyzsn.rentcar.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
import java.util.Objects;

@RestController()
@RequestMapping(value = "/address")
@CrossOrigin(value = "*")
public class AddressController {

    @Autowired
    private AddressService service;
    @PostMapping("/get_one")
    public Result getOne(@RequestBody Map<String,?> payload){
        List<Address> data= service.getOne(payload);
        return Result.succ(data);
    }


    @PostMapping("/add_one")
    public Result addOne(@RequestBody Map<String,?>payload){
        return Result.succ(service.addOne(payload));
    }

    @PostMapping("/delete_one")
    public Result deleteOne(@RequestBody Map<String,?>payload){
        return Result.succ(service.deleteOne(payload));
    }

    @PostMapping("/update_one")
    public Result updateOne(@RequestBody Map<String,?>payload){
        return Result.succ(service.updateOne(payload));
    }
    @GetMapping("/hello")
    public  String hello(){
        return "hello";
    }
}
